<%@ include file="/WEB-INF/jsp/core/header.jspf" %>

	<!-- This code written by : Willie Wheeler and John Wheeler -->
	<!-- For 'Spring In Practice' [Book written by Willie Wheeler and John Wheeler] -->

<html>
	<head>
		<title>Subscribe to the Mailing List</title>
		<link rel="stylesheet" type="text/css" href="${stylesUrl}" />
	</head>
	<body>
		<div id="body">
			<div><a href="${homeUrl}">Home</a></div>
			
			<h1>Subscribe to the Mailing List</h1>
						
			<c:if test="${not empty param.expired}">
				<div class="alert-box">
					Sorry, your previous subscription request has expired. To subscribe you
					will need to complete a new subscription request using the form below.
				</div>
			</c:if>
			<c:if test="${not empty param.failed}">
				<div class="alert-box">
					Sorry, we were unable to confirm your subscription. If you copied the
					URL from your confirmation e-mail into the browser, please make sure
					you copied the entire URL. Otherwise, you can complete a new subscription
					request using the form below.
				</div>
			</c:if>
						
			<p>To subscribe, please provide your name and e-mail address.</p>
						
			<%-- Specify the action explicitly to eliminate the expires param --%>
			<form:form id="mainForm" modelAttribute="subscriber" action="subscribe.do">
			    <form:errors>
					<div class="alert-box">${messages[0]}</div>
			    </form:errors>
				<div class="form-item">
					<div>Your first name:</div>
					<div><form:input path="firstName" /></div>
					<div class="form-error-message"><form:errors path="firstName"></form:errors></div>
				</div>
				<div class="form-item">
					<div>Your last name:</div>
					<div><form:input path="lastName" /></div>
					<div class="form-error-message"><form:errors path="lastName"></form:errors></div>
				</div>
				<div class="form-item">
					<div>Your e-mail address:</div>
					<div><form:input path="email" cssStyle="width:240px" /></div>
					<div class="form-error-message"><form:errors path="email"></form:errors></div>
				</div>
				<div class="form-item">
					<input type="submit" value="Subscribe"></input>
				</div>
			</form:form>
		</div>
	</body>
</html>
